package com.jack.submeiju.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jack.etc.DatabaseConfig;
import com.jack.submeiju.database.ConnectionManager;

/**
 * Servlet implementation class AppInitServlet
 */
public class AppInitServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	public void destroy() {
		super.destroy();

	}

	@Override
	public void init() throws ServletException {
		super.init();

		// init config

		// init database connection
		ConnectionManager.initConnectionManager(DatabaseConfig.url,
				DatabaseConfig.dbusername, DatabaseConfig.dbpassword);
		
	}

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public AppInitServlet() {
		super();
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
	}

}
